# MAKEFILE
#
# CS550
# 4/21/2011
#
# Aaron Chapin
# Matthew Patchin
# Jordan Santell
# Bo Yan
#

JAVAC = javac
JAVA = java
CLASSPATH = ./:/usr/share/java/JFlex.jar:/usr/share/java/cup.jar

program: Program.java
	$(JAVAC) Program.java

parse: interpreterext.cup
		$(JAVA) -classpath $(CLASSPATH) java_cup.Main interpreterext.cup

lex: interpreterext.flex
		$(JAVA) JFlex.Main interpreterext.flex
#		mv interpreterext.flex.java Yylex.java

sym.java parser.java: parse

Yylex.java: lex

compile: sym.java parser.java Yylex.java program
		$(JAVAC) sym.java parser.java Yylex.java

build: parse lex compile

run:	build
		$(JAVA) -classpath $(CLASSPATH) parser

view-func1: count.p
	less count.p

view-func2: countr.p
	less countr.p

view:
	less Program.java
	less interpreterext.cup
	less interpreterext.flex

clean:
		rm Yylex.java parser.java sym.java Yylex.java~ *.class
		rm AssignStatement.class Car.class Cdr.class Concat.class Cons.class
		rm DefineStatement.class Element.class Expr.class
		rm ExpressionList.class FunctionCall.class Ident.class
		rm IfStatement.class Intp.class List_.class Listp.class Minus.class
		rm Nullp.class Number.class ParamList.class Plus.class Proc.class
		rm Program.class RepeatStatement.class ReturnStatement.class
		rm Sequence.class Statement.class StatementList.class Times.class
		rm WhileStatement.class

